﻿using System;

namespace EventScavenger
{
    public class MachineLogEntry
    {
        #region Constructors
        //for serialization that requires a parameterless constructor
        public MachineLogEntry()
        {
        }
        public MachineLogEntry(string machine, string logName)
        {
            this.machine = machine;
            this.LogName = logName;
        }
        public MachineLogEntry(string machine, string logName, int pollFrequency)
        {
            this.machine = machine;
            this.LogName = logName;
            this.pollFrequency = pollFrequency;
        }
        #endregion

        #region Properties
        private int collectorId;
        public int CollectorId
        {
            get { return collectorId; }
            set { collectorId = value; }
        }
        private string collector;
        public string Collector
        {
            get { return collector; }
            set { collector = value; }
        }
        private string machine;
        public string Machine
        {
            get { return machine; }
            set { machine = value; }
        }
        private string logName;
        public string LogName
        {
            get { return logName; }
            set { logName = value; }
        }
        private bool enabled;
        public bool Enabled
        {
            get { return enabled; }
            set { enabled = value; }
        }
        private int pollFrequency;
        public int PollFrequency
        {
            get
            {
                if (pollFrequency > 0)
                    return pollFrequency;
                else
                    return 5;
            }
            set { pollFrequency = value; }
        }
        private DateTime lastPollTime = new DateTime(2000, 1, 1);
        public DateTime LastPollTime
        {
            get { return lastPollTime; }
            set { lastPollTime = value; }
        }
        private int machineLogID;
        public int MachineLogID
        {
            get { return machineLogID; }
            set { machineLogID = value; }
        }
        private int maxEntryCount = 300000;
        public int MaxEntryCount
        {
            get { return maxEntryCount; }
            set { maxEntryCount = value; }
        }

        private DateTime oldestEntry = new DateTime(2000, 1, 1);
        public DateTime OldestEntry
        {
            get { return oldestEntry; }
            set { oldestEntry = value; }
        }
        private DateTime newestEntry = new DateTime(2000, 1, 1);
        public DateTime NewestEntry
        {
            get { return newestEntry; }
            set { newestEntry = value; }
        }
        private int entryCount;
        public int EntryCount
        {
            get { return entryCount; }
            set { entryCount = value; }
        }

        private int pollFilterID;
        public int PollFilterID
        {
            get { return pollFilterID; }
            set { pollFilterID = value; }
        }
        private string pollingFilterName;
        public string PollingFilterName
        {
            get { return pollingFilterName; }
            set { pollingFilterName = value; }
        }
        public PollFilter PollFilter { get; set; }
        private DateTime? pollFilterLastChanged;
        public DateTime? PollFilterLastChanged
        {
            get { return pollFilterLastChanged; }
            set { pollFilterLastChanged = value; }
        }

        public bool DBImportEnabled { get; set; }
        public string DBImportServer { get; set; }
        public string DBImportDatabase { get; set; }
        #endregion

        #region HostOffline
        public bool HostOffline { get; set; }
        #endregion

        public override string ToString()
        {
            return machine + "\\" + logName;
        }
    }
}